package sample.pojo;

import java.util.LinkedList;

/**
 * @author ：five03
 * @description：TODO
 * @date ：2020/8/11 8:39 上午
 */
public class User {
    private String username;
    private String IP;
    private LinkedList<String> chattingRecords;     // 聊天记录

    public User(String username, String IP) {
        this.username = username;
        this.IP = IP;
        this.chattingRecords = new LinkedList<>();
    }

    public String getUsername() {
        return username;
    }

    public String getIP() {
        return IP;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setIP(String IP) {
        this.IP = IP;
    }

    public LinkedList<String> readChattingRecord() {
        return chattingRecords;
    }

    public void saveChattingRecord(String s) {
        this.chattingRecords.add(s);
    }

    @Override
    public String toString() {
        return "用户名 = " + username + '\n' +
                "IP = " + IP + '\n';
    }

    public void clearChattingRecord(){
        this.chattingRecords.clear();
    }
}
